var page = 1;

if("undefined" != typeof _ ){
	_.templateSettings = {
    evaluate: /<#([\s\S]+?)#>/g,
    interpolate: /<#=([\s\S]+?)#>/g,
    escape: /<#-([\s\S]+?)#>/g
	};
}


function tips_count(wx_post_id){
    	var id = wx_post_id;
        $.ajax({
            type: "post",
            url: tips_count_url,
            data: {id:id},
            dataType: "json",
            success: function(result) {
                if(result.code == 1){
                	var link = result.data.link;
                	window.location.href = link;
                }
            }
        });
}
 
		
function loadmore_ext(refresh){
	console.log(refresh);
	if(refresh){
 		return ; //do not add page
	}
	console.log(page,pages);
	if  (page < pages) {  
	 	page = page + 1;
		loadmore();  
     }else{
         $("#more_bt").html('没有更多');
     }
}
if("undefined" != typeof pages){ 
	if (page < pages){
			 $("#more_bt").show();
	}
	
	if ( (pages > 1 )&& ("undefined" == typeof scroll16 )){
		window.onscroll=function(){
				var a = document.documentElement.scrollTop==0? document.body.clientHeight : document.documentElement.clientHeight;
				var b = document.documentElement.scrollTop==0? document.body.scrollTop : document.documentElement.scrollTop;
				var c = document.documentElement.scrollTop==0? document.body.scrollHeight : document.documentElement.scrollHeight;
				c = c - 20;
				if(a+b>=c){
					console.log(a,b,c);
					loadmore_ext();
				}
		}
	}
}

$(document).ready(function(){
	
    $("#more_bt").on('click',function(event) {
       loadmore_ext();
    }); 
	//遍历后加载图片

	$(".lazyA").each(function(){
		$(this).attr('src',$(this).attr('data-original'));
	});
	$(".lazy").each(function(){
		$(this).attr('src',$(this).attr('data-original'));
	});	
	$(".lazyB").each(function(){
		$(this).css("background-image","url("+$(this).attr("data-original")+")");
	});
});
/*var _hmt = _hmt || [];
(function() {
	  var hm = document.createElement("script");
	  hm.src = "//hm.baidu.com/hm.js?e3510b85f5329e28816b6e59947b0187";
	  var s = document.getElementsByTagName("script")[0]; 
	  s.parentNode.insertBefore(hm, s);
})();*/



